package com.jmp.autocofiguration.util;

import org.springframework.cache.interceptor.KeyGenerator;

import java.lang.reflect.Method;

/**
 * Created by chengjiarui on 2018/4/26.
 */
public class RedisKeyGenerator implements KeyGenerator {

    public static final String SPLIT = ":";

    @Override
    public Object generate(Object target, Method method, Object... params) {
        StringBuilder sb = new StringBuilder();
//        sb.append(SPLIT).append(target.getClass().getName());
//        sb.append(SPLIT).append(method.getName());
        for (Object obj : params) {
            sb.append(SPLIT).append(String.valueOf(obj));
        }
        return sb.toString();
    }
}
